package com.jwdf.uda.view.dialog;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.view.LayoutInflater;
import android.view.View;
import com.jwdf.uda.R;
import com.jwdf.uda.bean.PbBean;
import com.jwdf.uda.databinding.DialogFinishEvaluationBinding;

/**
 * 类说明：评价对话框
 * 作者：huangqiuxin on 2016/5/26 15:16
 * 邮箱：648859026@qq.com
 */
public class FinishEvaluationDialog extends BaseDialog{
    private DialogFinishEvaluationBinding mDataBinding;
    private CallbackListener mListener;
    public interface CallbackListener{
        void onFinishEvaluation(PbBean.PbSignGuideEvaluation evaluation);
    }

    public FinishEvaluationDialog(Context context) {
        super(context);
        setCancelable(false);
    }

    public void setCallbackListener(FinishEvaluationDialog.CallbackListener listener){
        this.mListener = listener;
    }

    @Override
    protected View onInflateView(LayoutInflater inflater) {
        mDataBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_finish_evaluation, null, false);
        return mDataBinding.getRoot();
    }

    @Override
    protected void onInitView(View view) {
        mDataBinding.tvBad.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if(mListener != null) mListener.onFinishEvaluation(PbBean.PbSignGuideEvaluation.GUIDE_EVALUATION_BAD);
            }
        });
        mDataBinding.tvGeneral.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if(mListener != null) mListener.onFinishEvaluation(PbBean.PbSignGuideEvaluation.GUIDE_EVALUATION_NORMAL);
            }
        });
        mDataBinding.tvGood.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if(mListener != null) mListener.onFinishEvaluation(PbBean.PbSignGuideEvaluation.GUIDE_EVALUATION_GOOD);
            }
        });
    }
}
